package cn.rengy.web.framework.shiro.token;

import org.apache.shiro.authc.AuthenticationToken;
/**
 * 微信小程序登陆token
 * @author rengy
 *
 */
public class WechatAppToken implements AuthenticationToken{

	private static final long serialVersionUID = -4593565323804197160L;
	private String code;//调用wx.login得到的登录凭证
	private String rawData;//开放数据
	private String signature;//签名 用于校验rawData完整性
	private String appid;//小程序appid  referer header 格式  https://servicewechat.com/{appid}/{version}/page-frame.html
	private Long wxAccountId;//多app登陆需要传wxAccountId 
	private String host;
	
	public WechatAppToken(String code) {
		this.code = code;
	}
	public WechatAppToken(String code, Long wxAccountId) {
		this.code = code;
		this.wxAccountId = wxAccountId;
	}
	
	public WechatAppToken(String code, String rawData, String signature) {
		this.code = code;
		this.rawData = rawData;
		this.signature = signature;
	}
	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}
	public Object getPrincipal() {
        return code;
    }

    public Object getCredentials() {
        return code;
    }

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Long getWxAccountId() {
		return wxAccountId;
	}

	public void setWxAccountId(Long wxAccountId) {
		this.wxAccountId = wxAccountId;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getRawData() {
		return rawData;
	}

	public void setRawData(String rawData) {
		this.rawData = rawData;
	}

	public String getSignature() {
		return signature;
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}
    
}
